using System;
using System.Collections.Generic;
using System.Text;

namespace qtControlLibrary
{
    /// <summary>
    /// The State baseclass. Every state should derive from this class and override its members
    /// </summary>
    /// <typeparam name="T"></typeparam>
    abstract class State<T>
    {
        /// <summary>
        /// Gets the instance of this state
        /// </summary>
        /// <returns></returns>
        public virtual State<T> Instance()
        {
            return this;
        }

        /// <summary>
        /// Returns the Description
        /// </summary>
        /// <returns></returns>
        public abstract string Description();

        /// <summary>
        /// Handles messages sent to the event      
        /// </summary>
        /// <param name="Entity">The entity that the states belong too</param>
        /// <param name="msg">The messeage to be sent to this state</param>
        /// <returns></returns>
        public abstract bool OnMessage(T Entity, Telegram msg);

        /// <summary>
        /// When this state starts this should get called once before the execute
        /// </summary>
        /// <param name="Entity">The entity that the states belong too</param>
        public abstract void Enter(T Entity);

        /// <summary>
        /// The Execute function runs the main logic of the state and should get called every frame
        /// </summary>
        /// <param name="Entity">The entity that the states belong too</param>
        public abstract void Execute(T Entity);

        /// <summary>
        /// The exit state should get called when this state switches to a new one
        /// </summary>
        /// <param name="Entity">The entity that the states belong too</param>
        public abstract void Exit(T Entity);
    }
}
